<template>
  <div class="children">
    <h2>我是子组件</h2>
    <h4>我有{{ toy }}</h4>
    <h4>父亲给我了{{ car }}</h4>
    <button @click="sendToy(toy)">把玩具给父亲</button>
  </div>
</template>

<script setup lang="ts" name="Children">
import { ref } from "vue";

let toy = ref("乐高");
//子组件要接收参数，声明接收 props
defineProps(["car", "sendToy"]);
</script>

<style scoped>
.children {
  background-color: skyblue;
  padding: 10px;
  box-shadow: 0 0 10px black;
  border-radius: 10px;
}
</style>
